#include "Basis.h"
#include <SDL/SDL_opengl.h>
#include <GL/gl.h>

Basis::Basis(Vector3 position, double length, Color color)
: SceneObject(position), length(length), color(color)
{
}

Basis::~Basis()
{
}

void Basis::Draw()
{
	glBegin(GL_LINES);
	glColor3ub(color.GetRed(), color.GetGreen(), color.GetBlue());
	// axes
	glVertex2d(0, 0); glVertex2d(length, 0);
	glVertex2d(0, 0); glVertex2d(0, length);
	glVertex3d(0, 0, 0); glVertex3d(0, 0, length);
	// arrows
	glVertex2d(length, 0); glVertex2d(length * 0.9, length * 0.1);
	glVertex2d(length, 0); glVertex2d(length * 0.9, -length * 0.1);
	glVertex2d(0, length); glVertex2d(length * 0.1, length * 0.9);
	glVertex2d(0, length); glVertex2d(-length * 0.1, length * 0.9);
	glVertex3d(0, 0, length); glVertex3d(0, length * 0.1, length * 0.9);
	glVertex3d(0, 0, length); glVertex3d(0, -length * 0.1, length * 0.9);
	glEnd();
}
